package javacafe.action.workshop;

import java.util.List;

import javacafe.action.Action;
import javacafe.action.ActionForward;
import javacafe.dto.event.SeminarDTO;
import javacafe.dto.event.WorkshopDTO;
import javacafe.dto.member.LoginInfoDTO;
import javacafe.serviceimple.SeminarServiceImple;
import javacafe.serviceimple.WorkshopServiceImple;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UpdateWorkshopAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		ActionForward actfoward = new ActionForward();
		WorkshopServiceImple schservice = WorkshopServiceImple.getInstance();
		
		String workshop_no = request.getParameter("workshop_no").trim();
		String workshop_name = request.getParameter("workshop_name");
		String workshop_explain = request.getParameter("workshop_explain");

		WorkshopDTO dto = new WorkshopDTO();
		dto.setWorkshop_no(Integer.parseInt(workshop_no));
		dto.setWorkshop_name(workshop_name);
		dto.setWorkshop_explain(workshop_explain);
						
		 schservice.updateWorkshop(dto);
		
		 List<WorkshopDTO> lists = schservice.getAllWorkshop();
		System.out.println(lists.toString());
		
		request.setAttribute("wLists", lists);
		actfoward.setUrl("listworkshop");
		return actfoward;
	}
}
